package com.xxxx.server.controller;

import com.xxxx.server.pojo.RespBean;
import com.xxxx.server.pojo.RespPageBean;
import com.xxxx.server.pojo.Salary;
import com.xxxx.server.service.IEmployeeService;
import com.xxxx.server.service.impl.SalaryServiceImpl;
import com.xxxx.server.vo.SalarySobCfgVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * 员工账套
 *
 * @author zhoubin
 * @since 1.0.0
 */
@RestController
@RequestMapping("/salary/sobcfg")
public class SalarySobCfgController {
    @Autowired
    private SalaryServiceImpl salaryService;
    @Autowired
    private IEmployeeService employeeService;

    /**
     * 查询员工套账信息
     * @param respPageBean
     * @return
     */
    @ApiOperation("查询员工套账信息")
    @GetMapping("/")
    public Map<String, Object>selcetSalaryCfg(RespPageBean respPageBean){

        Map<String, Object>map = salaryService.selectSalaryCfg(respPageBean);

        return map;
    }

    /**
     * 查询修改工资账套数据
     * @return
     */
    @ApiOperation("查询职位")
    @RequestMapping("/salaries")
    @GetMapping("/")
    public List SalaryCfg(){
        List<Salary> list = salaryService.list();
        return list;
    }

    @ApiOperation("修改员工账套")
    @PutMapping("/")
    public RespBean updateSalaryCfg(Integer eid,Integer sid){
        int row =  employeeService.updateSalary(eid,sid);
            if(row > 0){
                return RespBean.success("修改成功");
            }else {
                return RespBean.error("修改失败");
            }

    }










}